{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAAAAADji6uXAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAFkSURBVGje7dkhS2VBGIfx35UNNoNhw4JsEPwGYrirZbPJsMnbhC1+AKMgWA3adptRwbiIyG4Qi2ASwbRmg8GgZddwz0WjcwSd8/I+aQ4MPPOfl5k5cw5JkiRJkvRKOh9jHsvYbSkce+uE8YUfSjr/xz9s4Qa/upAwvrCohiMm8LErCeMLi2p4iS9dSxhfWHQefsZV0z7BQhcSxhcW76WjEfa7kjC+sGgdjmPb8L0UNrGB+5oTxhcWrcN7XD97XsMh/tScMIUprF9YfB4e4Dsmu5IwvrC4huf4hqNmtH25l76zsNUdn+H3GljBDm5rTRhf2LqGIz5hFeu1JowvbFXDU+xjqXmeMrx3vOSOEX9K674fPucnBp721Gn8rTFhfGHrvbTXcrTxp7Q763AGF57W4RzOakwYX9i6hrCHxab9G19rTBhf+Kr30oHhf+DZmhPGF76qhnd4aNo/ak0YX5gkSZIkCY8pNif8+pvgrgAAAABJRU5ErkJggg==",
      "text/plain": [
       "28×28 reinterpret(Gray{Float32}, ::Array{Float32,2}):\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " ⋮                                                                               ⋱  ⋮                                                         \n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAAAAADji6uXAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAHnSURBVGje7dm9axRBHMbxz6ngG+Jpk5S2gkX8A3wvbSys0oiVhTY2goJIsNBCS0EwjUQUBYVUVjYiguJLIRZ2QqLYCAYhvoDGYja4Lrd6uYM4+TFfONj57c49+/AwuzM7FAqFQqFQKKx8Or2KW/CxdnIBN3G/as/g4YCCq5bbYXzBnhl2pZw2tHT6gJfV8QW8wJdcHcYX7LSd2I3D1fG4NDbbeIBpPMGz3BzGF+z0c9EY1uEKNmNbS8cZvMN1TOJnDg7jC/aVYZNz1Z3uxMGWa7ZiLgeH8QUHynCRLkalHCewvnauZLhsrBmm86fqN4rPfmd4D19zcRhfcKgMYb+U2aaqPYcpfMvFYXzBoZ6lpDnp3lr7MXbl5DC+4FDj8Ki0BllkAhdzcxhfcKAMV2MjjtfueBa38T03h/EFB8rwEO7U2q+kNf6bHB3GF1xShmulNcOZWu0H7uJ8rg7jCy5pTnMJJxu1SRzL2WF8wb7G4XbcwI5abQFXcTp3h/EF/5nhPumb91ijPoUTK8FhfMG/PksPSHOXbqP+FGcxX7Xf422uDuMLtma4B7cw0sefXMapXB3GF2zdA5715zfsJs+lMXpNWhOWPeD/JtjzfTgv5XOkUX8t7dvDI2m/MHuH8QULhUKhMDy/ABA9RHL4RmlRAAAAAElFTkSuQmCC",
      "text/plain": [
       "28×28 reinterpret(Gray{Float32}, ::Array{Float32,2}):\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " ⋮                                                                               ⋱  ⋮                                                         \n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAAAAADji6uXAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAGcSURBVGje7dixS1VhHMbxj5aYDZGDoUXUkFOToyAo5CC4WVP/QRC5JLQ0SUOD3LG1yc1BsDWdCxRawjUQbmRlQYtBOZxzUZzOOYP3PT/eBy6H91xevnx5OO89v0tOTk5OTk5OTk5O/zPQZNMlvMAq5vG+xt7BizaMD7xcd8MQ1vC0XE/KHfYZWPs57GD5zPor7uA4VcP4wFodzmMTI+fuv8LLVA3jAyt3eBXvMIsDPMFv7OAn7qObomF8YOXfwxVFf7+wiE8YLb8bxYTcYZ+AlTt8VF7fKPqDx20wjA+s1OHt8rOP1+W9W3jeBsP4wEodjuEatpyepR3F+yh8w5dUDeMDa82Hc/iMe4o5v5d9fE/VMD6wUoe72MYMbuJfub6OKWykbBgfWPk5fIBxLCjeaXYVZ+sUPqRsGB9Y6yzt4m3bDOMDa/9f2sswpttgGB/YuMMlxWx/6HReTNIwPrBxhw/L6zr+pGwYH9i4w142UzeMD2zU4Q3FnP8XR6kbxgc26vAZruAH9lI3jA9s1OFd/MfHNhjGB+bk5PQ/J0sINMh0e0OMAAAAAElFTkSuQmCC",
      "text/plain": [
       "28×28 reinterpret(Gray{Float32}, ::Array{Float32,2}):\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " ⋮                                                                               ⋱  ⋮                                                         \n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  …  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)\n",
       " Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)     Gray{Float32}(0.0)  Gray{Float32}(0.0)  Gray{Float32}(0.0)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "3-element Array{UInt8,1}:\n",
       " 0x01\n",
       " 0x07\n",
       " 0x09"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "┌ Info: Loading MNIST...\n",
      "└ @ Main /kuacc/users/dyuret/.julia/dev/Knet/data/mnist.jl:33\n"
     ]
    }
   ],
   "source": [
    "# Take a look at some random images and labels in data\n",
    "using Pkg; for p in (\"Knet\",\"Images\"); haskey(Pkg.installed(),p) || Pkg.add(p); end\n",
    "using Knet,Images,Random\n",
    "include(Knet.dir(\"data\",\"mnist.jl\"))\n",
    "xtrn,ytrn,xtst,ytst = mnist()\n",
    "rp = randperm(10000)\n",
    "for i=1:3; display(mnistview(xtst,rp[i])); end\n",
    "display(ytst[rp[1:3]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Main.LeNet"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "include(\"lenet.jl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "This example learns to classify hand-written digits from the [MNIST](http://yann.lecun.com/exdb/mnist) dataset.  There are 60000 training and 10000 test examples. Each input x consists of 784 pixels representing a 28x28 image.  The pixel values are normalized to [0,1]. Each output y is converted to a ten-dimensional one-hot vector (a vector that has a single non-zero component) indicating the correct class (0-9) for a given image.  10 is used to represent 0.\n",
       "\n",
       "You can run the demo using `julia lenet.jl` at the command line or `julia> LeNet.main()` at the Julia prompt.  Use `julia lenet.jl --help` or `julia> LeNet.main(\"--help\")` for a list of options.  The dataset will be automatically downloaded.  By default the [LeNet](http://yann.lecun.com/exdb/lenet) convolutional neural network model will be trained for 10 epochs.  The accuracy for the training and test sets will be printed at every epoch and optimized parameters will be returned.\n"
      ],
      "text/plain": [
       "  This example learns to classify hand-written digits from the MNIST (http://yann.lecun.com/exdb/mnist) dataset. There are 60000 training and 10000\n",
       "  test examples. Each input x consists of 784 pixels representing a 28x28 image. The pixel values are normalized to [0,1]. Each output y is converted\n",
       "  to a ten-dimensional one-hot vector (a vector that has a single non-zero component) indicating the correct class (0-9) for a given image. 10 is\n",
       "  used to represent 0.\n",
       "\n",
       "  You can run the demo using \u001b[36mjulia lenet.jl\u001b[39m at the command line or \u001b[36mjulia> LeNet.main()\u001b[39m at the Julia prompt. Use \u001b[36mjulia lenet.jl --help\u001b[39m or \u001b[36mjulia>\n",
       "  LeNet.main(\"--help\")\u001b[39m for a list of options. The dataset will be automatically downloaded. By default the LeNet (http://yann.lecun.com/exdb/lenet)\n",
       "  convolutional neural network model will be trained for 10 epochs. The accuracy for the training and test sets will be printed at every epoch and\n",
       "  optimized parameters will be returned."
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@doc LeNet"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "usage: <PROGRAM> [--seed SEED] [--batchsize BATCHSIZE] [--lr LR]\n",
      "                 [--fast] [--epochs EPOCHS] [--iters ITERS]\n",
      "                 [--gcheck GCHECK] [--atype ATYPE]\n",
      "\n",
      "lenet.jl (c) Deniz Yuret, 2016. The LeNet model on the MNIST\n",
      "handwritten digit recognition problem from\n",
      "http://yann.lecun.com/exdb/mnist.\n",
      "\n",
      "optional arguments:\n",
      "  --seed SEED           random number seed: use a nonnegative int for\n",
      "                        repeatable results (type: Int64, default: -1)\n",
      "  --batchsize BATCHSIZE\n",
      "                        minibatch size (type: Int64, default: 128)\n",
      "  --lr LR               learning rate (type: Float64, default: 0.1)\n",
      "  --fast                skip loss printing for faster run\n",
      "  --epochs EPOCHS       number of epochs for training (type: Int64,\n",
      "                        default: 3)\n",
      "  --iters ITERS         maximum number of updates for training (type:\n",
      "                        Int64, default: 9223372036854775807)\n",
      "  --gcheck GCHECK       check N random gradients per parameter (type:\n",
      "                        Int64, default: 0)\n",
      "  --atype ATYPE         array and float type to use (default:\n",
      "                        \"KnetArray{Float32}\")\n",
      "\n"
     ]
    }
   ],
   "source": [
    "LeNet.main(\"--help\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lenet.jl (c) Deniz Yuret, 2016. The LeNet model on the MNIST handwritten digit recognition problem from http://yann.lecun.com/exdb/mnist.\n",
      "opts=(:batchsize, 128)(:fast, false)(:iters, 9223372036854775807)(:atype, \"KnetArray{Float32}\")(:epochs, 3)(:gcheck, 0)(:lr, 0.1)(:seed, -1)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "┌ Info: Loading MNIST...\n",
      "└ @ Main.LeNet /kuacc/users/dyuret/.julia/dev/Knet/data/mnist.jl:33\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(:epoch, 0, :trn, 0.08234842414529915, :tst, 0.08002804487179487)\n",
      "  8.393859 seconds (9.52 M allocations: 666.953 MiB, 9.94% gc time)\n",
      "(:epoch, 1, :trn, 0.9594350961538461, :tst, 0.9635416666666666)\n",
      "  1.952749 seconds (735.72 k allocations: 209.751 MiB, 1.10% gc time)\n",
      "(:epoch, 2, :trn, 0.9733072916666666, :tst, 0.9753605769230769)\n",
      "  1.958024 seconds (740.46 k allocations: 209.807 MiB, 1.28% gc time)\n",
      "(:epoch, 3, :trn, 0.9789329594017094, :tst, 0.9791666666666666)\n"
     ]
    }
   ],
   "source": [
    "model = LeNet.main(\"\");"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 1.0.0",
   "language": "julia",
   "name": "julia-1.0"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.0.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
